package com.ruoyi.common.utils.CL253Api;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.http.HttpUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: wwy
 * @Date: 2021/3/5 9:40
 */
public class VoiceApi {
    private String appId;
    private String appKey;
    private String url;

    public VoiceApi(String appId,String appKey,String url){
        this.appId = appId;
        this.appKey = appKey;
        this.url = url;
    }

    public JSONObject sendVoice(String phone,String templateId, Map<String,String> option){
        Map<String,String> param = new HashMap<>();
        param.put("appId",appId);
        param.put("appKey",appKey);
        param.put("mobile",phone);
        param.put("templateId",templateId);
        if(option != null){
            param.putAll(option);
        }

        String response = HttpUtils.post(url,param);
        return JSONObject.parseObject(response);

    }
}
